home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of Shareware
/
Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso
/
mac
/
DOS
/
PROGRAMG
/
ULTRA250
/
UW_HELP3.HLP
< prev
next >
Wrap
Text File
|
1992-11-03
|
23KB
|
666 lines
`co(4,7);──────────────────────── /// The Keyboard/Mouse ──────────────────────────────`co();
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(init_mouse,/// init_mouse); `keyword(end_mouse ,/// end_mouse); `keyword(m_reset ,/// m_reset); │
│ `keyword(set_idle_func,/// set_idle_func); `keyword(set_key_func,/// set_key_func); `keyword(get_key ,/// get_key); │
│ `keyword(wait_event,/// wait_event); `keyword(event_pending,/// event_pending); `keyword(m_pos ,/// m_pos); │
│ `keyword(wait_ticks,/// wait_ticks); `keyword(check_key ,/// check_key); `keyword(m_released ,/// m_released); │
│ `keyword(m_hide,/// m_hide); `keyword(m_show ,/// m_show); `keyword(m_motion ,/// m_motion); │
│ `keyword(m_moveto,/// m_moveto); `keyword(m_pressed ,/// m_pressed); `keyword(m_ratio ,/// m_ratio); │
│ `keyword(m_colrange,/// m_colrange); `keyword(m_rowrange,/// m_rowrange); │
│ `keyword(m_lpen_on,/// m_lpen_on); `keyword(m_lpen_off,/// m_lpen_off); │
└──────────────────────────────────────────────────────────────────────────┘
The UltraWin library interfaces to the user through either the keyboard,
mouse, or both. The keyboard routines support all possible key presses
which include left and right Shift, Alt, and Ctrl key combinations. The
mouse routines allow complete control of a two or three button mouse, and
is Microsoft driver compatible. The event routines handle detecting both
mouse and keyboard presses for you, so making your programs support a
mouse is a snap! In addition, UltraWin allows you to define your own
background function, which is called any place in the library that waits
for user input. This allows you to write your own processing routines to
be performed in the background, then call one function to notify the
library of your routine, then just forget all about it! Refer to the
set_idle_func and wait_event functions for details.
`co(10,1);/// init_mouse`co(); `keyword(source,[UW_EVENT.C]~init_mouse);
Call this function just after init_video or force_video if you wish to
use the mouse in your program. If the mouse is connected and a driver is
installed, then the global variable Mouse_exists is set to TRUE (1). In
addition the mouse cursor column and row ranges are set to cover the
entire text screen. After calling this function you may show the mouse on
the screen using the function m_show.
Prototype:
void init_mouse(void);
Parameters:
None.
Usage:
init_mouse();
`co(10,1);/// end_mouse`co(); `keyword(source,[UW_EVENT.C]~end_mouse);
If the mouse was found to be present in init_mouse, this function turns
the mouse back off. This keeps the mouse from being active at the DOS
prompt. Call this prior to exiting your program if your program called
init_mouse or the lower level m_reset function.
Prototype:
void end_mouse(void);
Parameters:
None.
Usage:
end_mouse();
`co(10,1);/// m_reset`co(); `keyword(source,[UW_EVENT.C]~m_reset);
This is the lower level function called by both init_mouse and
end_mouse. It is used both to determine if the mouse exists, and also to
reset the mouse prior to program exit.
Prototype:
void m_reset(M_RESET *m)
Parameters:
`co(11,1); M_RESET *m`co();
A variable of type M_RESET. Refer to the structures/globals topic for
information on the members of this structure.
Usage:
M_RESET m;
...
m_reset(&m);
`co(10,1);/// set_idle_func`co(); `keyword(source,[UW_EVENT.C]~set_idle_func);
Allows you to define your own background process. Simply write your own
C function, keeping in mind that to remain responsive to the keyboard you
should keep your code tight and fast. Then call set_idle_func with the
pointer to your function.
Prototype:
void set_idle_func( int (*func_ptr)(void) );
Parameters:
`co(11,1); int (*func_ptr)(void)`co();
A pointer to the function you wish to install as the idle function.
Usage:
process()
{
...
}
...
set_idle_func( process );
`co(10,1);/// wait_event`co(); `keyword(source,[UW_EVENT.C]~wait_event);
Waits until either a key is pressed, or a mouse button is clicked. The
global variable Event will contain the information about the event. If it
is a keyboard event, the key or combination of keys pressed is saved. If
a mouse event, then the button that was pressed, how many times it was
pressed, and the x and y coordinate at which the press occurred is saved.
While UltraWin waits for user input, it is free to perform background
processing. If a user defined function has been installed with
set_idle_func, that function will be called during idle time.
Prototype:
void wait_event(void);
Parameters:
None.
Usage:
wait_event();
`co(10,1);/// event_pending`co(); `keyword(source,[UW_EVENT.C]~event_pending);
Checks for an event, and returns TRUE (1) if an event has occurred or
FALSE (0) if no event has occurred. If an event has occurred, then the
information about the event, which includes the event type (keyboard or
mouse), the key and modifier, or the mouse location and button status is
returned in the global Event variable. Refer to `keyword(Structures/Globals,[uw_help1.hlp]/// Structures/Globals); for
information about the EVENT structure and member names for extracting
this information.
Prototype:
int event_pending(void);
Parameters:
None.
Usage:
int status;
...
status = event_pending();
`co(10,1);/// wait_ticks`co(); `keyword(source,[UW_EVENT.C]~wait_event);
Waits for a given number of system ticks. There are 18.2 system ticks
per second. If you have defined a background process with the
set_idle_func function, it will call your process function while it waits
for the given ticks to pass. UltraWin now has enhanced timer support.
See `keyword(Timer/Sound Support,[uw_help6.hlp]/// Timer/Sound Support); for further details.
Prototype:
void wait_ticks( clock_t ticks );
Parameters:
`co(11,1); int ticks`co();
The number of system ticks to wait. Be sure to pass this as a long or
cast your number to a clock_t.
Usage:
wait_ticks( 9L );
wait_ticks( (clock_t) 37 );
`co(10,1);/// check_key`co(); `keyword(source,[UW_EVENT.C]~check_key);
Checks to see if a key has been pressed, and returns the key without
pulling it out of the keyboard buffer. The key value is returned (see
UW_KEYS.H for key defines). If no key has been pressed, then check_key
will return FALSE (0).
You can "capture" any key by installing a function that is called by
check_key. This is set by calling `keyword(set_key_func,/// set_key_func);. Check key will
pass this function the key and modifier. When the called function
returns, if 1 is returned, check_key acts as though no key was ever
hit, if a 0 is returned, the key is then passed through. This is a
very useful, low-level way to supply "hot-keys" anywhere in your
program, even while entering data!
Prototype:
int check_key(void);
Parameters:
None.
Usage:
int key;
...
key = check_key();
`co(10,1);/// set_key_func`co(); `keyword(source,[UW_EVENT.C]~set_key_func);
Allows you to define your own "hotkey" function. Simply write your own
"C" function, keeping in mind that to remain responsive to the keyboard you
should keep your code tight and fast. Then call set_key_func with the
pointer to your function. Your function is passed the key and key
modifier. See `keyword(check_key,/// check_key); for more details.
Prototype:
void set_key_func( int (*func_ptr)(int, int) );
Parameters:
`co(11,1); int (*func_ptr)(int, int)`co();
A pointer to the function you wish to install as the key function.
Usage:
process(int key, int mod)
{
...
}
...
set_key_func( process );
`co(10,1);/// get_key`co(); `keyword(source,[UW_EVENT.C]~get_key);
Waits until a key has been pressed, and returns the key value (see
UW_KEYS.H for key defines).
Prototype:
int get_key();
Parameters:
None.
Usage:
int key;
...
key = get_key();
`co(10,1);/// m_hide`co(); `keyword(source,[UW_EVENT.C]~m_hide);
Hides the mouse cursor. Call this function to remove the mouse cursor
temporarily from the screen when you are doing window output. Call the
m_show function after your window output to put the cursor back on the
screen.
NOTE: Even though the mouse is not shown on the screen, the cursor will
still track with the mouse, and mouse buttons are still active.
Prototype:
void m_hide(void);
Parameters:
None.
Usage:
m_hide();
`co(10,1);/// m_show`co(); `keyword(source,[UW_EVENT.C]~m_show);
Shows the mouse cursor. This is used to undo the affect of m_hide.
Prototype:
void m_show(void);
Parameters:
None.
Usage:
m_show();
`co(10,1);/// m_pos`co(); `keyword(source,[UW_EVENT.C]~m_pos);
Gets the current location of the mouse, as well as the status of the
buttons.
Prototype:
void m_pos( M_LOC *m )
Parameters:
`co(11,1); M_LOC *m`co();
A pointer to a variable of type M_LOC that contains the position and
button status information. Refer to the structures/globals topic above
for information about the M_LOC structure.
Usage:
M_LOC m;
...
m_pos( &m );
`co(10,1);/// m_moveto`co(); `keyword(source,[UW_EVENT.C]~m_moveto);
Moves the mouse to the position specified by column and row.
Prototype:
void m_moveto( int col, int row );
Parameters:
`co(11,1); int col, row`co();
The column and row at which the mouse cursor is to be placed.
Usage:
m_moveto( 10, 25 );
`co(10,1);/// m_pressed`co(); `keyword(source,[UW_EVENT.C]~m_pressed);
Checks to see if the button passed has been pressed since the last call
to this function, and return the button count (number of clicks) and the
location where the click occurred. A press has occurred when the M_LOC
count member is greater than 0.
Prototype:
void m_pressed( int button, M_LOC *m );
Parameters:
`co(11,1); int button`co();
The button to test for being pressed. This can be one of the defines
(in UW.H) LB, MB, or RB.
`co(11,1); M_LOC *m`co();
A pointer to a variable of type M_LOC that the function will use to
place the position and button status information.
Usage:
M_LOC m;
...
m_pressed( LB, &m );
`co(10,1);/// m_released`co(); `keyword(source,[UW_EVENT.C]~m_released);
Performs the same function as m_pressed, but is used to test when the
mouse button is released.
Prototype:
void m_released( int button, M_LOC *m );
Parameters:
`co(11,1); int button`co();
The button to test for being released. This can be one of the defines
(in UW.H) LB, MB, or RB.
`co(11,1); M_LOC *m`co();
A pointer to a variable of type M_LOC that the function will use to
place the position and button status information.
Usage:
M_LOC m;
...
m_released( LB, &m );
`co(10,1);/// m_colrange`co(); `keyword(source,[UW_EVENT.C]~m_colrange);
Allows you to set the range of columns that the mouse will be allowed to
move within. Typically this will be from 0 to V_cols-1, but you may set
it to a range less than this if you wish to keep the mouse inside a
subrange of the screen.
Prototype:
void m_colrange( int col_min, int col_max );
Parameters:
`co(11,1); int col_min, col_max`co();
The column mininum and maximum values.
Usage:
m_colrange( 0, V_cols );
`co(10,1);/// m_rowrange`co(); `keyword(source,[UW_EVENT.C]~m_rowrange);
Is the complement to m_colrange. Typically this will be from 0 to
V_rows-1, but like m_colrange you may set it to a range less than this if
you wish to keep the mouse inside a subrange of the screen.
Prototype:
void m_rowrange( int row_min, int row_max );
Parameters:
`co(11,1); int row_min, row_max`co();
The row mininum and maximum values.
Usage:
m_rowrange( 0, V_rows );
`co(10,1);/// m_motion`co(); `keyword(source,[UW_EVENT.C]~m_motion);
Reports the net motion of cursor since last call to this function. A
pointer to a variable of type M_MOVE is used to pass back the information.
Prototype:
void m_motion( M_MOVE *m );
Parameters:
`co(11,1); M_MOVE *m`co();
A pointer to a variable of type M_MOVE. See `keyword(Structures/Globals,[uw_help1.hlp]/// Structures/Globals); for
information on the M_MOVE members.
Usage:
M_MOVE mv;
...
m_motion( &mv );
`co(10,1);/// m_lpen_on`co(); `keyword(source,[UW_EVENT.C]~m_lpen_on);
Turns on light pen emulation. This is the default.
Prototype:
void m_lpen_on();
Parameters:
None.
Usage:
m_lpen_on();
`co(10,1);/// m_lpen_off`co(); `keyword(source,[UW_EVENT.C]~m_lpen_off);
Turns off light pen emulation.
Prototype:
void m_lpen_off();
Parameters:
None.
Usage:
m_lpen_off();
`co(10,1);/// m_ratio`co(); `keyword(source,[UW_EVENT.C]~m_ratio);
Sets mouse to pixel ratio. The default values are 16 for horizontal and
8 for vertical.
Prototype:
void m_ratio( int horiz, int vert );
Parameters:
`co(11,1); int horiz, vert`co();
The values for the new horizontal and vertical ratios.
Usage:
m_ratio( 12, 8 );
`co(4,7);──────────────────────── /// The Window Manager ──────────────────────────────`co();
`keyword(Introduction,/// Window Manager Introduction);
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(link_window,/// link_window); `keyword(unlink_window,/// unlink_window); `keyword(make_top_window,/// make_top_window); │
│ `keyword(cr_inwindow,/// cr_inwindow); `keyword(move_wn_left,/// move_wn_left); `keyword(move_wn_right,/// move_wn_right); │
│ `keyword(move_wn_up,/// move_wn_up); `keyword(move_wn_down,/// move_wn_down); `keyword(reset_all_masks,/// reset_all_masks); │
│ `keyword(refresh_desktop,/// refresh_desktop); `keyword(refresh_column,/// refresh_column); `keyword(refresh_row,/// refresh_row); │
│ `keyword(redisplay_rect,/// redisplay_rect); │
└──────────────────────────────────────────────────────────────────────────┘
`co(4,7);────────────────────/// Window Manager Introduction ──────────────────────────`co();
The window manager is a set of routines that make having multiple
windows on the screen at once a snap! By using the window manager, you
bypass having to keep track of window masking and refreshing, as the
manager takes care of all the nitty gritty details of multiple overlapping
windows. To use the manager, first create a window with `keyword(wn_create,[uw_help1.hlp]/// wn_create); that is
the size of the screen, and call `keyword(link_window,/// link_window); with that window. This is
your background, or desktop window. Then you may create and link any
number (limited only by the amount of memory you have in your computer) of
windows of any size, regardless of whether they overlap each other, and
output text to them using any of the window I/O routines. At any time you
may also unlink a window from the linked list with `keyword(unlink_window,/// unlink_window);, which
removes it from the screen as well. The link_window/unlink_window sequence
may be called as many times as you wish, with the same window created with
wn_create. When you are finally ready to dispose of your window, simply
call unlink_window followed by `keyword(wn_destroy,[uw_help1.hlp]/// wn_destroy);.
`co(10,1);/// link_window`co(); `keyword(source,[UW_ENTRY.C]~link_window);
Takes the window created with `keyword(wn_create,[uw_help1.hlp]/// wn_create); by pointer and links it to the
window manager's linked list. The window is placed on the screen, and if
it overlaps any other window, then their masks are set to prevent output
to the area that overlaps. The window is then drawn on the video screen.
Prototype:
WINDOW *link_window( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window created with wn_create.
Usage:
WINDOW wn;
...
link_window(&wn);
`co(10,1);/// unlink_window`co(); `keyword(source,[UW_WIN.C]~unlink_window);
Takes the window by pointer, removes it from the linked list, resets any
window's masks that were overlapped, and redraws any portion of any window
that was covered by the window. This is the complement to `keyword(link_window,/// link_window);.
After calling `keyword(wn_create,[uw_help1.hlp]/// wn_create);, you may call link_window and unlink_window as many
times as you wish. When you wish to finally free the memory used by the
window, simply unlink the window from the list with unlink_window and call
`keyword(wn_destroy,[uw_help1.hlp]/// wn_destroy);.
Prototype:
int unlink_window( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to unlink.
Usage:
WINDOW wn;
...
wn_create( 0, 0, 79, 24, SGL_BDR, WN_NORMAL, wnp );
link_window(&wn);
...
unlink_window(&wn);
wn_destroy(&wn);
`co(10,1);/// make_top_window`co(); `keyword(source,[UW_WIN.C]~make_top_window);
Takes a pointer to the window, and makes it the top window. All
adjustments to the masks of all windows are made, and the window is drawn
to the screen.
Prototype:
int make_top_window( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to bring to the top.
Usage:
WINDOW *wnp;
...
make_top_window(wnp);
`co(10,1);/// cr_inwindow`co(); `keyword(source,[UW_WIN.C]~cr_inwindow);
Takes a location on the screen, and returns the topmost window that
contains that location. If there is no window under the location, then a
NULL is returned.
Prototype:
WINDOW *cr_inwindow( int col, int row )
Parameters:
`co(11,1); int col, row`co();
The col,row coordinate (x,y) to check.
Usage:
WINDOW *wnp;
...
wnp = cr_inwindow( 20, 37 );
`co(10,1);/// move_wn_left`co(); `keyword(source,[UW_WIN.C]~move_wn_left);
Takes a window in the manager's linked list, and moves it smoothly to
the left a given number of columns.
Prototype:
void move_wn_left( int cols, WINDOW *wnp );
Parameters:
`co(11,1); int cols`co();
The number of columns to move left.
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
move_wn_left( 3, wnp );
`co(10,1);/// move_wn_right`co(); `keyword(source,[UW_WIN.C]~move_wn_right);
Takes a window in the manager's linked list, and moves it smoothly to
the right a given number of columns.
Prototype:
void move_wn_right( int cols, WINDOW *wnp );
Parameters:
`co(11,1); int cols`co();
The number of columns to move right.
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
move_wn_right( 2, wnp );
`co(10,1);/// move_wn_up`co(); `keyword(source,[UW_WIN.C]~move_wn_up);
Takes a window in the manager's linked list, and moves it smoothly up a
given number of rows.
Prototype:
void move_wn_up( int rows, WINDOW *wnp );
Parameters:
`co(11,1); int rows`co();
The number of rows to move up.
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
move_wn_up( 1, wnp );
`co(10,1);/// move_wn_down`co(); `keyword(source,[UW_WIN.C]~move_wn_down);
Takes a window in the manager's linked list, and moves it smoothly down
a given number of rows.
Prototype:
void move_wn_down( int rows, WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
`co(11,1); int rows`co();
The number of rows to move down.
Usage:
WINDOW *wnp;
...
move_wn_down( 1, wnp );
`co(10,1);/// reset_all_masks`co(); `keyword(source,[UW_WIN.C]~reset_all_masks);
Walks through all the windows in the manager's linked list, and resets
their output masks so that only the visible areas of the windows are
modified during window output. Calling this function is not necessary
unless you adjust a window's mask yourself, and want to set all window
masks back to their default state.
Prototype:
void reset_all_masks();
Parameters:
None.
Usage:
reset_all_masks();
`co(10,1);/// refresh_desktop`co(); `keyword(source,[UW_WIN.C]~refresh_desktop);
Walks through the linked list of windows and redraws each. This is a
quick way to redisplay the screen. It can be useful when returning from
executing another program, returning from graphics mode, etc...
Prototype:
void refresh_desktop(void);
Parameters:
None
Usage:
refresh_desktop();
`co(10,1);/// refresh_column`co(); `keyword(source,[UW_WIN.C]~refresh_column);
Walks through the linked list of windows and checks to see if each
window contains a particular column. If the window contains the column,
then only that column is refreshed. This function is used internally by
wn_move_left and wn_move_right.
Prototype:
void refresh_column( int col )
Parameters:
`co(11,1); int col`co();
The column to refresh (redraw).
Usage:
refresh_column( 20 );
`co(10,1);/// refresh_row`co(); `keyword(source,[UW_WIN.C]~refresh_row);
Walks through the linked list of windows and checks to see if each
window contains a particular row. If the window contains the row, then
only that row is refreshed. This function is used internally by
wn_move_up and wn_move_down.
Prototype:
void refresh_row( int row )
Parameters:
`co(11,1); int row`co();
The row to refresh (redraw).
Usage:
refresh_row( 5 );
`co(10,1);/// redisplay_rect`co(); `keyword(source,[UW_WIN.C]~redisplay_rect);
Refreshes a rectangular portion of the manager's screen, defined by a
variable of type RECT. The window manager calls this function when a
window is unlinked with unlink_window. The window's pane is used as the
rectangular area passed.
NOTE: Use the set_rect function to define a variable of type RECT.
Prototype:
void redisplay_rect( RECT *rectp );
Parameters:
`co(11,1); RECT *rectp`co();
A pointer to the rectangular area to display.
Usage:
RECT r;
...
redisplay_rect( &r );